'use strict';

const Controller = require('egg').Controller;

class mjtspeak extends Controller {
  async index() {
    const data = await this.ctx.service.mjtspeak.findAll(this.ctx);
    this.ctx.body = data;
  }
  async create() {
    const ctx = this.ctx;
    const params = ctx.request.body;
    const data = await ctx.service.mjtspeak.create(params);
    ctx.body = data;
  }
  async destroy() {
    const ctx = this.ctx;
    const mjtspeakId = ctx.params.id;
    const del = await ctx.service.mjtspeak.delete(mjtspeakId);
    ctx.body = del;
  }
  async update() {
    const ctx = this.ctx;
    const mjtspeakId = ctx.params.id;
    const params = ctx.request.body;
    const change = await ctx.service.mjtspeak.update(mjtspeakId, params);
    ctx.body = change;
  }
  async show() {
    const ctx = this.ctx;
    const id = ctx.params.id;
    const mjtspeak = await this.ctx.service.mjtspeak.find(id);
    ctx.body = mjtspeak;
  }
  async index0() {
    const ctx = this.ctx;
    const uid = ctx.params.uid;
    console.log(uid);
    const data = await this.ctx.service.mjtspeak.findAll0(uid);
    this.ctx.body = data;
  }
  async index00() {
    const ctx = this.ctx;
    const isopen = ctx.params.isopen;
    console.log(isopen);
    const data = await this.ctx.service.mjtspeak.findAll00(isopen);
    this.ctx.body = data;
  }
}
module.exports = mjtspeak;
